﻿Imports MeoTom.Core.BLL
Imports MeoTom.Core

Partial Public Class LinkCategory
    Inherits System.Web.UI.Page
    Public lc As New LinkCat()
    Public util2 As New Utilities.Common()

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Request.QueryString("action") = "Delete" Then
            Dim previousPage As String = ""
            If Request.QueryString.ToString = vbNullString Then
                previousPage = Server.UrlEncode(Request.ServerVariables("PATH_INFO"))
            Else
                previousPage = Server.UrlEncode(Request.ServerVariables("PATH_INFO") & "?" & Request.QueryString.ToString())
            End If
            util2.ValidateLogin(previousPage)

            lc.CatID = Integer.Parse(Request.QueryString("ID"))
            lc.Delete()
            lc.WriteLinkCat(5)
            Response.Redirect("/mt-inside/LinkCategory.aspx", False)
        ElseIf Request.QueryString("action") = "Edit" Then
            Dim control As New UI.Control
            control = Page.LoadControl("~/Control/LinkCategoryEdit.ascx")
            pnlControl.Controls.Add(control)
        Else
            Dim control As New UI.Control
            control = Page.LoadControl("~/Control/LinkCategory.ascx")
            pnlControl.Controls.Add(control)
        End If
    End Sub
End Class